package com.ncepu.clubmanagement.config;

import com.ncepu.clubmanagement.filter.LoginFilter;
import com.ncepu.clubmanagement.utils.JwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class LoginFilterConfig {


        @Bean
        public FilterRegistrationBean<LoginFilter> loginFilterRegistrationBean(JwtUtils jwtUtils) {
            FilterRegistrationBean<LoginFilter> registrationBean = new FilterRegistrationBean<>();
            registrationBean.setFilter(new LoginFilter(jwtUtils));
            registrationBean.addUrlPatterns("/*");
            return registrationBean;
        }

}
